﻿using System;
using Microsoft.AspNetCore.Mvc;
using BCCommon;
using BCService.Sim.Admin.AdminOperationRecord;
using BCDto.Sim.Admin.AdminOperationRecord;

namespace BCTMSRESTful.Controllers.Management.AdminOperationRecord
{
    [ApiExplorerSettings(GroupName = "Admin")]
    [Route("api/v1/sim/[controller]")]
    public class AdminOperationRecordController : ManagementBaseController
    {
        private readonly IAdminOperationRecordService adminOperationRecordService;
        public AdminOperationRecordController(IAdminOperationRecordService adminOperationRecordService)
        {
            this.adminOperationRecordService = adminOperationRecordService;
        }

        /// <summary>
        /// 获取一组系统管理员操作记录信息。
        /// </summary>
        /// <param name="operationName">操作名称</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="companyId">公司ID</param>
        /// <param name="index">自 1 开始的页码编号。</param>
        /// <param name="size">每页显示的数据条数。</param>
        /// <response code="200">带有分页信息的系统异常信息列表。</response>
        /// <returns></returns>
        [HttpGet]
        [ProducesResponseType(typeof(PageableList<AdminOperationRecordDto>), 200)]
        public IActionResult Get([FromQuery(Name = "operation_name")]string operationName,
            [FromQuery(Name = "start")]DateTime? start,
            [FromQuery(Name = "end")]DateTime? end, 
            [FromQuery(Name = "company_id")]int? companyId,
            [FromQuery(Name = "index")]int index = 1,
            [FromQuery(Name = "size")]int size = 10)
        {
            return this.Ok(this.adminOperationRecordService.GetAdminOperationRecords(index, size,operationName,null,start,end, companyId));
        }

    }
}
